﻿using System;
using System.Collections.Generic;
using System.Text;

namespace WHHXMQ.mq
{
    public class ReportMsg
    {
        /// <summary>
        /// 接口类型，   （此字段固定为：“FAULT”）
        /// </summary>
        public string interfacetype;
        /// <summary>
        /// 接口版本，                  （接口版本号，字符串，如：”1.0”）
        /// </summary>
        public string version;
        /// <summary>
        /// 厂商ID，                   （参考4.2厂商编号）
        /// </summary>
        public string companyid;
        /// <summary>
        /// MSGID，                   （唯一标识，要求采用UUID）
        /// </summary>
        public string MSGID;
        /// <summary>
        /// 设备类型，                  （参考4.1设备类型）
        /// </summary>
        public string devicetype;
        /// <summary>
        /// 1级故障描述，  
        /// </summary>
        public string error1;
        /// <summary>
        /// 2级故障描述，  
        /// </summary>
        public string error2;
        /// <summary>
        /// 3级故障描述，  
        /// </summary>
        public string error3;
        /// <summary>
        /// 监测点名称，
        /// </summary>
        public string roadname;
        /// <summary>
        /// 检测设备编号，              （参考4.3设备编码）
        /// </summary>
        public string deviceid;
        /// <summary>
        /// 故障时间，                  （YYYY-MM-DD HH24:MM:SS）
        /// </summary>
        public string occurtime;
        /// <summary>
        /// 数据上传时间                （YYYY-MM-DD HH24:MM:SS）
        /// </summary>
        public string reporttime;

        /// <summary>
        /// 设备状态上报信息
        /// </summary>
        public ReportMsg()
        {
        //软件故障    1
        //电路故障    2
        //网络故障    3
        //数据异常    13  无数据上传             1
        //              数据延迟、数据质量异常     2

            interfacetype = "FAULT";
            version = "1.0";
            companyid = "0002";
            MSGID = Guid.NewGuid().ToString("N");
            devicetype = "02";
            error1 = "-1";
            error2 = "-1";
            error3 = "-1";
            roadname = "";
            deviceid = "";
            occurtime = "";
            reporttime = "";
        }

        public string ToMQString()
        {
            return (interfacetype + "," + version + "," + companyid + "," + MSGID + "," + devicetype + "," + error1 + "," + error2 + "," + error3 + "," + roadname + "," + deviceid + "," + occurtime + "," + reporttime);
        }
    }
}
